package enums;

import utils.Utils;

	/**
	 * 
	 * represent the colors of the players in the game
	 *
	 */

public enum PlayerColor
{
	RED , BLUE , NONE;
	
	@Override
	public String toString()
	{

		return Utils.beginWithCapital(name());
	}
	public static PlayerColor Convert( int i ) {
		return values()[i];
	}
	/**
	 * set which color will play next
	 * @param color
	 * 
	 */
	public static PlayerColor flipColor (PlayerColor color) {
		return (color == RED) ? BLUE : RED; 
	}
	public static PlayerColor fromString (String color) {
		for (int i=0 ; i < values().length ; ++i) {
			if (values()[i].toString().equals(color)) {
				return PlayerColor.Convert(i);
			}
		}
		return NONE;
	}
}